feat(cli): prompt for OpenAI API key in interactive mode#403
feat(cli): prompt for OpenAI API key in interactive mode#403AliaksandrNazaruk wants to merge 1 commit intothesysdev:mainfrom
Conversation
When running create-chat-app interactively, prompt the user for their OpenAI API key, create the .env file automatically, and simplify the getting-started instructions. In non-interactive mode, the behavior remains unchanged. Closes thesysdev#399
rabisg
left a comment
There was a problem hiding this comment.
This works great - just a minor change for simplifying the code
|
|
||
| console.info(getStartedMessage(name, devCmd)); | ||
| if (!options.noInteractive) { | ||
| const apiKeyArgs = await resolveArgs( |
There was a problem hiding this comment.
resolveOne was meant as a utility for when the value can be passed from both the cli as flags and in interactive mode. Since we don't want this in non-interactive mode or a flag for this, you can directly use inquirer here
There was a problem hiding this comment.
+1
Also, this can be reorganized into a fn in the lib/ folder to clean up the command and keep it as a high-level orchestrator.
There was a problem hiding this comment.
There's also a merge conflict to be resolved with the skill option.
I think it can be extended to a 3-step scenario
- Ask for OpenAI SDK BaseUrl (read a comment/issue about someone using OpenRouter, I personally used Gemini) (default value can be something like "Use OpenAI")
- (If they add a custom url) Ask for model name
- Ask for Api Key
Wdyt?
Drawbacks: prolongs the setup process
There was a problem hiding this comment.
We can keep this PR simple and just take the API key
We can discuss the long term roadmap for OpenUI cli setup on the issue
|
hi @AliaksandrNazaruk - would love to get this merged. Are you planning on patching the PR anytime soon? |
Summary
When running
create-chat-appinteractively, prompt the user for their OpenAI API key instead of printing manual instructions. If a key is provided, the CLI creates the.envfile automatically and simplifies the getting-started output. In non-interactive mode, behavior is unchanged.Changes
packages/openui-cli/src/commands/create-chat-app.ts: After installing dependencies, prompt for the OpenAI API key using the existingresolveArgshelper. If provided, write.envand show a streamlined message. If skipped (blank input) or non-interactive, show the original instructions.Closes #399